Static Keyword: 1.What is the output ? public class StaticDemo { int num1 = 6; static int num2 = 10; public static void main(String args[]) { StaticDemo s1 = new StaticDemo(); StaticDemo s2 = new StaticDemo(); s1.num1 = 15; s1.num2 = 17; s2.num1 = 22; s2.num2 = 28; System.out.println(s1.num1 + " " + s1.num2 + " " + s2.num1 + " "+ s2.num2); } } A. 15 17 22 28 B. 15 17 22 17 C. 15 28 22 28 D. 22 17 22 28 E. 22 28 22 28 F. compile time error 2.Which of the following will compile when inserted in the following code? (Choose all that apply) public class Demo { final String exam1 = "O"; static String exam2 = "C"; static{ // CODE SNIPPET 1 } static { // CODE SNIPPET 2 } } A. exam1 = “A”; instead of // CODE SNIPPET 1 B. exam 2 = “J”; instead of // CODE SNIPPET 1 C. exam 1 = “P”; instead of // CODE SNIPPET 2 D. exam 2 = “8”; instead of // CODE SNIPPET 2 E. compile time error. F. Exception at run time. 3. What is the output of the program ? public class StaticDemo { static String n1= examName("O");{ n1=examName("A"); } static{ n1=examName("C"); } public static void main(String[] args) { StaticDemo sd = new StaticDemo(); } public static String examName(String s){ System.out.println(s); return s; } } A. It prints O C A in that order when run B. It prints C A O in that order when run C. It prints O A C in that order when run D. It prints C A O in that order when run E. Compile time error. F. Exception at run time. 4. Which of the lines will fail to compile ? public class StaticDemo { StaticDemo sd = new StaticDemo(); void method1() { method4(); // 1 StaticDemo.method2(); // 2 StaticDemo.method3(); // 3 } static void method2() { } void method3() { method1(); //4 method2(); //5 sd.method2(); //6 } static void method4() { } } A. 1 B. 2 C. 3 D. 4 E. 5 F. 6 G. Compile time error. 5. What is the output ? public class StaticDemo { int num1 = 3; static int num2 = 5; StaticDemo(int num1, int num2) { if (num2 < 30) { this.num2 = num2; } num1 = num1; } public static void main(String args[]) { StaticDemo s1 = new StaticDemo(9, 10); StaticDemo s2 = new StaticDemo(12, 22); System.out.println(s1.num1 + " " + s1.num2 + " " + s2.num1 + " "+ s2.num2); } } A. 9 10 12 22 B. 9 22 12 22 C. 9 10 12 10 D. 3 22 3 22 E. Compile time error. 11. In the following code, radius is declared as private in the class Circle, and myCircle is an instance of class Circle. Does the code cause any error problems? If so, explain why? class Circle { private double radius = 1; public double getArea() { return radius * radius * Math.PI; } public static void main(String[] args) { Circle myCircle = new Circle(); System.out.println("Radius is " + myCircle.radius); System.out.println("Area of cirle: " +myCircle.getArea()); } }